package com.example.controller;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * springboot 支持redis  1
 * jeids
 */

@SpringBootConfiguration
@PropertySource(value = {"redis.properties"})
public class jedisConfig {
    @Value("${spring.redis.host}")
    private  String host;
    @Value("${spring.redis.port}")
    private  Integer port;
    @Value("${spring.redis.password}")
    private String password;

    @Bean
    public JedisPool jedisPool(){
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, 3000, password);
        return jedisPool;

    }
}
